package com.zhsj.OkeHomeConsumption.update;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.zhsj.OkeHomeConsumption.R;


/**
 * Created by rxy on 17/7/26.
 */

public class ConfirmDialog extends Dialog {

    ConfirmCallback callback;
    private TextView version_text, time_text;
    private TextView sureBtn,size;
    public TextView cancleBtn;

    public ConfirmDialog(Context context, ConfirmCallback callback) {
        super(context, R.style.CustomDialog);
        this.callback = callback;
        setCustomDialog();
    }

    private void setCustomDialog() {
        View mView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_confirm, null);
        sureBtn = (TextView) mView.findViewById(R.id.dialog_confirm_sure);
        cancleBtn = (TextView) mView.findViewById(R.id.dialog_confirm_cancle);
        version_text = (TextView) mView.findViewById(R.id.version_text);
        size = (TextView) mView.findViewById(R.id.dialog_confirm);
        time_text = (TextView) mView.findViewById(R.id.time_text);


        sureBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                callback.callback();
                ConfirmDialog.this.cancel();
            }
        });
        super.setContentView(mView);
    }

    public ConfirmDialog setVersion(String s) {
        version_text.setText(s);
        return this;
    }
    public ConfirmDialog setTime(String s) {
        time_text.setText(s);
        return this;
    }
    public ConfirmDialog setContent(String s) {
        size.setText(s);
        return this;
    }
}
